# coding:utf-8
# Author: legend
# @Time： 2020/8/27 下午10:05
class NoModify(type):

    def __setattr__(cls, key, value):
        raise AttributeError("cannot modify anything")

    def __delattr__(cls, item):
        raise AttributeError("cannot modify anything")


class NoInit:
    def __init__(self):
        raise AttributeError('cannot init instance')


class Frozen(NoInit, metaclass=NoModify):
    pass


class StatFieldMergeStrategy(Frozen):
    NULL = 0
    SUM = 1
    AVERAGE = 2


class DataType(Frozen):
    INT = 'int'
    BIGINT = 'bigint'
    FLOAT = 'float'
    STR = 'str'


class AlarmStatus(Frozen):
    CREATED = 0
    AUTO_CLEAR = 1
    MANUAL_CLEAR = 2


class AlarmLevel(Frozen):
    FATAL = 0
    SERIOUS = 1
    WARNING = 2


class AlarmConfigCondition(Frozen):
    EQUAL = 0
    UNEQUAL = 1
    GTE = 2
    LTE = 3
    CONTAIN = 4
    NOT_CONTAIN = 5


class AlarmConfigSnmpType(Frozen):
    NOT_SEND = 0
    SEND = 1


class ServiceStatus(Frozen):
    STOPPED = 0
    RUNNING = 1


class DeviceStatus(Frozen):
    OFFLINE = 0
    ONLINE = 1


class ServiceDeploymentConfig(Frozen):
    MASTER = 0
    STANDBY = 1


class AppDeploymentType(Frozen):
    MASTER_OR_STANDBY = 0
    BALANCE = 1
    INDEPENDENCE = 2


class Provider(Frozen):
    CHINA_MOBILE = 0
    CHINA_TELECOM = 1
    CHINA_UNINCOM = 2


class YesOrNo(Frozen):
    NO = 0
    YES = 1


class ProcessStatus(Frozen):
    RUNNING = 1
    SLEEPING = 2
    DISK_SLEEP = 3
    STOPPED = 4
    TRACING_STOP = 5
    ZOMBIE = 6
    DEAD = 7
    WAKE_KILL = 8
    WAKING = 9
    IDLE = 10
    PARKED = 11


class FileType(Frozen):
    YAML = 1
    CONF = 2
    INI = 3
    XML = 4
    INTF = 5
    CNF = 6


class FormType(Frozen):
    INPUT = 1
    SELECT = 2
    RADIO = 3
    CHECKBOX = 4
    LIST = 5


class FormDataType(Frozen):
    INT = 1
    BIGINT = 2
    FLOAT = 3
    STR = 4


class Apps(Frozen):
    # NGS应用ID
    NGS_AGENT_ID = 2000
    NGS_APP_SERVER_ID = 2001
    NGS_STAT_SERVER_ID = 2002
    NGS_OPLATFORM_ID = 2003
    NGS_OPLATFORM_CLIENT_ID = 2004
    NGS_SUBSCRIBE_SERVER_ID = 2005
    NGS_ALARM_SERVER_ID = 2006
    NGS_PRE_STAT_SERVER_ID = 2007

    # 第三方应用ID
    MYSQL_ID = 1000
    FTP_ID = 1001
    REDIS_ID = 1002
    NGINX_ID = 1003


class JobStatus(Frozen):
    OFFLINE = 0
    ONLINE = 1


class DpiLayer(Frozen):
    COLLECT = 1
    MERGE = 2
    WRITEFILE = 3


class STDeviceInfo(Frozen):
    NAME = '设备信息数据'
    CODE = 200
    DATASOURCE_ID = 2


class STDeviceRunning(Frozen):
    NAME = '设备运行数据'
    CODE = 201
    DATASOURCE_ID = 2


class STServiceRunning(Frozen):
    NAME = '设备服务运行数据'
    CODE = 202
    DATASOURCE_ID = 2


class STAppBusiness(Frozen):
    NAME = '应用业务数据'
    CODE = 301
    DATASOURCE_ID = 3


class STAppBusinessAggregation(Frozen):
    NAME = '应用业务聚合数据'
    CODE = 302
    DATASOURCE_ID = 3


class STDpiLayer(Frozen):
    NAME = 'DPI业务层数据'
    CODE = 401
    DATASOURCE_ID = 4


class STHistory(Frozen):
    NAME = '历史数据'
    CODE = 501
    DATASOURCE_ID = 5


class StatType(Frozen):
    DEVICE_INFO = STDeviceInfo
    DEVICE_RUNNING = STDeviceRunning
    SERVICE_RUNNING = STServiceRunning
    APP_BUSINESS = STAppBusiness
    APP_BUSINESS_AGGREGATION = STAppBusinessAggregation
    DPI_LAYER = STDpiLayer
    HISTORY = STHistory


class AppType(Frozen):
    DPIV3 = 1
    DPIV5 = 2
    DPIV6 = 3
    NGS = 4
    NETLOG = 5
    ASTD = 6
    THIRD_PARTY = 7
    DPIV6_PLATFORM = 8


class JobRunStatus(Frozen):
    RUNNING = 0
    SUCCESS = 1
    FAILED = 2


class RequestMethod(Frozen):
    GET = 0
    POST = 1
    DELETE = 2
    PUT = 3
    PATCH = 4


class PermissionGroupType(Frozen):
    NORMAL = 0
    SUPER = 1
